home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / BKISSSRC.ZIP / LOADER / CREATE.INC < prev    next >
Encoding:
Text File  |  1994-02-11  |  1.7 KB  |  35 lines

  1. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. ;           DS:SI ==> ASCIIZ extension to add to filename (with period)
  3. ;           DS:DI ==> location to place resulting filename
  4. ;
  5. proc        CreateFilename
  6.             mov ax,6200h                ;\
  7.             int 21h                     ; \
  8.             mov es,bx                   ;  > ES:BX ==> environment segment
  9.             mov es,[word es:2Ch]        ; /
  10.             xor bx,bx                   ;/
  11. @@FindStart:cmp [word es:bx],0000h      ;\
  12.             jz @@GotStart               ; \
  13.             inc bx                      ;  > ES:BX ==> filename of program
  14.             jmp @@FindStart             ; /
  15. @@GotStart: add bx,4                    ;/
  16. @@CopyName: mov al,[byte es:bx]         ;\
  17.             inc bx                      ; \
  18.             mov [byte ds:di],al         ;  \ copy the full pathname
  19.             inc di                      ;  /
  20.             or al,al                    ; /
  21.             jnz @@CopyName              ;/
  22. @@GoBack:   cmp [byte ds:di],'.'        ;\
  23.             jz @@GotDot                 ; \ search back for the extension
  24.             dec di                      ; /
  25.             jmp @@GoBack                ;/
  26. @@GotDot:   mov al,[byte ds:si]         ;\
  27.             inc si                      ; \
  28.             mov [byte ds:di],al         ;  \ add on the given extension
  29.             inc di                      ;  /
  30.             or al,al                    ; /
  31.             jnz @@GotDot                ;/
  32.             ret                         ;return
  33. endp        CreateFilename
  34. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  35.